package ai.peanut.cloudtwo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.HashMap;
import java.util.Map;

@RestController
public class CouponController {

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/coupon/{id}")
    public Map findOrderById(@PathVariable Long id) {
        Map a = new HashMap() ;
        a.put("coupon","coupon") ;
        return a;
    }

    @GetMapping("/coupon/getCouponFormMemer")
    public Map findOrderById() {
        return this.restTemplate.getForObject( "http://192.168.1.3:8011/member/1",
                Map.class);

    }
}
